package com.woniuxy.consumer.student.configuration;

import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author: linKe
 * @Date: 2022/1/21 17:25
 * @FileName: HystrixDashboardConfiguration
 * @version: 1.0
 * @Description: 描述
 */
@Configuration
public class HystrixDashboardConfiguration {
    /**
     * 配置hystrix 监控其他界面
     *
     * @return 结果
     */
    @Bean
    public ServletRegistrationBean getServlet() {
        HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet();
        ServletRegistrationBean registrationBean =
                new ServletRegistrationBean(streamServlet);
        registrationBean.setLoadOnStartup(1);
        registrationBean.addUrlMappings("/hystrix.stream");
        registrationBean.setName("HystrixMetricsStreamServlet");
        return registrationBean;
    }

}
